<?php

namespace app\api\controller;

use app\backend\model\SysSite as SysSiteModel;

class ZhAvideo  extends Common
{
    public function index(){
        $wxapp_id = $this->request->get('wxapp_id');
        if (!$wxapp_id) {
            return $this->ajaxReturn($this->errorCode, '缺少平台参数');
        }
        $wxSetting = SysSiteModel::where('wxapp_id', $wxapp_id)->find();
        if (!$wxSetting) {
            return $this->ajaxReturn($this->errorCode, '平台参数未配置');
        }

        $where = [];
        $where['wxapp_id'] = $wxapp_id;

        $data =\app\backend\model\ZhAvideo::where($where)->select();
        foreach ($data as &$d){
            $d["videos"]=json_decode(htmlspecialchars_decode($d['videos']), true);

        }
        return $this->ajaxReturn($this->successCode, '返回成功', $data);
    }
}